<template>
  <div>
    <div class="search">
      <div class="header">
        <homeHeader></homeHeader>
      </div>
      <div class="ser-body">
        <div class="ser-input">
          <div class="kuanzi">
            <input
              type="text"
              placeholder="找影视剧、影人、影院"
              v-model="key"
            />

            <img
              @click="getGoodList"
              src=""
              alt=""
            />
          </div>
        </div>
      </div>

      <!-- 导航------------------------------------- -->
      <div class="ser-nav">
        <div class="nav">
          <div
            class="bt"
            @click="change(1)"
            :class="{ active: boardIndex == 1 }"
          >
            影视剧
          </div>
          <div
            class="bt"
            @click="change(2)"
            :class="{ active: boardIndex == 2 }"
          >
            影人
          </div>
          <div
            class="bt"
            @click="change(3)"
            :class="{ active: boardIndex == 3 }"
          >
            影院
          </div>
        </div>
      </div>

      <!-- 内容----------------------------- -->
      <div class="ser-con">
        <tv v-if="boardIndex == 1"></tv>
        <man v-else-if="boardIndex == 2"></man>
        <yinyuan v-else-if="boardIndex == 3"></yinyuan>
      </div>
    </div>
    <homeFooter></homeFooter>
  </div>
</template>
<style scoped lang="scss">
.search {
  width: 100%;
  overflow: hidden;

  .header {
    width: 100%;
    height: 81px;
    background: pink;
  }

  //   搜索内容------------------------------------------
  .ser-body {
    width: 100%;
    height: 96px;
    background: #47464a;

    .ser-input {
      width: 1200px;
      height: 96px;
      margin: 0 auto;

      overflow: hidden;
      margin-bottom: 10px;

      .kuanzi {
        width: 630px;
        height: 50px;
        background: #fff;
        margin: 0 auto;
        margin-top: 30px;
        border-radius: 30px;
        overflow: hidden;

        input {
          width: 560px;
          height: 30px;
          margin-left: 20px;
          margin-top: 10px;
          border: 0;
          outline: none;
          font-size: 20px;
          color: #000;
        }

        img {
          width: 22px;
          height: 22px;
          margin-top: 14px;
          cursor: pointer;
        }
      }
    }
  }
}

// 导航---------------------------------
.ser-nav {
  width: 100%;
  height: 60px;
  background: #47464a;
  margin-bottom: 26px;

  .nav {
    width: 1200px;
    height: 60px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;

    .bt {
      width: 154px;
      height: 60px;
      text-align: center;
      line-height: 60px;
      font-size: 16px;
      color: #999;
    }

    .bt:hover {
      color: #fff;
    }

    .active {
      color: #ef4238;
    }
    .active:hover {
      color: #ef4238;
    }
  }
}

.ser-con {
  width: 100%;
}
</style>
<script>
import tv from "../components/search/Tv";
import man from "../components/search/Man";
import yinyuan from "../components/search/Yinyuan";
import homeHeader from "../components/home/header";
import homeFooter from "../components/home/homefooter";

export default {
  data() {
    return {
      key: "",
      boardIndex: 1,
    };
  },
  components: {
    tv,
    man,
    yinyuan,
    homeHeader,
    homeFooter,
  },
  created() {
    console.log(this.$route.query.kw); //取关键词
  },
  methods: {
    getGoodList() {
      console.log(this.key);
    },
    change(index) {
      this.boardIndex = index;
    },
  },
};
</script>